<?php

// +----------------------------------------------------------------------
// | TAODUDU.COM  [ Simple Efficient Excellent ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://www.taodudu.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: ubten <462193409@qq.com> http://www.ubten.com/
// +----------------------------------------------------------------------

/**
 * Description of video
 *
 * @author Administrator
 */
class video_controller extends company {

    //put your code here
    function index_action() {
        $video=$this->obj->DB_select_once("company_video","`uid`='".$this->uid."'","`title`,`id`,`picurl`");
        $this->yunset("video",$video);
        $this->public_action();
        $this->yunset("js_def",2);
        $this->com_tpl('video');
    }


    function savevideo_action(){
        $com=$this->obj->DB_select_once("company","`uid`='".$this->uid."'","`hy`,`provinceid`");
        $ids = $_POST['id'];
        $data['picurl']= $_POST['picurl'];
        $data['title']=iconv("UTF-8", "GB2312//IGNORE", $_POST['oldName']);
        $data['ctime']=time();
        $data['hy'] = $com['hy'];
        $data['provinceid'] = $com['provinceid'];
        $data['uid']=$this->uid;
        if(empty($ids)){
            $id=$this->obj->insert_into("company_video",$data);
            if($id){
                echo TRUE;
            }else{
                echo FALSE;
            }
        }else{
            $this->obj->update_once("company_video",$data,array("id"=>(int)$ids));
            echo TRUE;
        }
    }

}
